'''
Show date, time and workweek number
'''
# -*- coding: utf-8 -*-
from tkinter import *
import datetime

def UpdateInfo():

    mNow = datetime.datetime.now()
    mDate['text'] = mNow.strftime('%Y/%m/%d  ') + mNow.strftime('%a')
    mWorkweek['text']   = u'WW' + str(datetime.date.today().isocalendar()[1]+1) + u'.' + mNow.strftime('%w  ') + mNow.strftime('%p ') + mNow.strftime('%I:%M')

    #  Take advantage of the after method
    root.after(Update_Interval, UpdateInfo)
    return

if __name__ == '__main__':
    root = Tk()
    root.title(u'Workweek')

    mNow = datetime.datetime.now()

    mDate = Label(root, text='', font=("Arial Bold", 20))
    mDate.grid(row=0, column=1, sticky=W)
    mDate['fg']     = 'blue'
    mDate['text'] = mNow.strftime('%Y/%m/%d  ') + mNow.strftime('%a')

    mWorkweek = Label(root, text='', font=("Arial Bold", 20))
    mWorkweek.grid(row=2, column=1, sticky=W)
    mWorkweek['fg']     = 'blue'
    mWorkweek['text']   = u'WW' + str(datetime.date.today().isocalendar()[1]+1) + u'.' + mNow.strftime('%w  ') + mNow.strftime('%p ') + mNow.strftime('%I:%M')

    mwidth = 260
    mheight = 70

    # make the windows to fixed size
    root.maxsize(mwidth, mheight)
    root.minsize(mwidth, mheight)

    # make init position to right down corner of window.
    hs = root.winfo_screenheight()
    ws = root.winfo_screenwidth()
    x = ws - mwidth
    y = hs - mheight * 2
    root.geometry('%dx%d+%d+%d' % (mwidth, mheight, x, y))

    # keep the program always top of other windows.
    root.wm_attributes("-topmost", 1)

    Update_Interval = 5000  # ms
    UpdateInfo()

    root.mainloop()

    root.quit
    root.destroy